<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
   xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
   xmlns:f="http://xmlns.jcp.org/jsf/core"
   xmlns:h="http://xmlns.jcp.org/jsf/html"
   xmlns:p="http://primefaces.org/ui"
   xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
   xmlns:pe="http://primefaces.org/ui"
   template="/WEB-INF/templates/business/buyer/template.xhtml">
   
   	<f:metadata>
	   	<f:viewParam name="bulletinId" value="#{bulletinHome3.id}"></f:viewParam>
	   	<f:viewParam name="taskId" value="#{bpmHome.taskId}"></f:viewParam>
	   	<f:event listener="#{bulletinHome3.initConversation()}" type="preRenderView"></f:event>
   	</f:metadata>  
   	<ui:define name="buyer_content">
   
		<h:form id="editForm"  >         
			<p:panel id="panel" header="择优选取公告信息" style="margin-bottom:10px;">
		       <p:messages id="messages" closable="true"><p:autoUpdate/></p:messages>
		        <ui:include src="/manage/template/include/bulletinInfo.xhtml" />
			</p:panel>
			<p:panel id="requalifations" header="资质要求" style="margin-bottom:10px;">
				<ui:include src="/manage/template/include/bulletinReqInfo.xhtml" />		 
			</p:panel>
			<p:panel header="相关附件">	
				 <ui:include src="/WEB-INF/templates/include/bulletinAttachments.xhtml" />
			</p:panel>
						
			<p:panel header="备选中介报名材料评分">
				<p:dataTable value="#{bulletinHome3.instance.bestTrades}" var="_trade" rowIndexVar="_row">
					<p:column headerText="序号" style="text-align: center;" width="30">
						<h:outputText value="#{_row + 1}" />
					</p:column>
					
					<p:column headerText="中介机构" width="300">
						<h:outputText value="#{_trade.supplier.cnname}" />
					</p:column>
					
					<p:column headerText="报价">
						<p:outputPanel style="text-align: right;">
							<h:outputText value="#{_trade.tradeReportData.offer}">
								<f:convertNumber maxFractionDigits="2"/>
							</h:outputText>
						</p:outputPanel>
					</p:column>
					
					<p:column headerText="报价分值">
						<p:outputPanel style="text-align: right;">
							<h:outputText value="#{_trade.tradeReportData.offerScore}">
								<f:convertNumber maxFractionDigits="2"/>
							</h:outputText>
						</p:outputPanel>
					</p:column>
					
					<c:forEach items="#{bulletinHome3.instance.defs}" var="_rd">
						<p:column headerText="#{_rd.requiredName}">
							<p:outputPanel style="text-align: right;">
								<h:outputText value="#{bestTradeEvaluationOfBulletinList.resultMap[_trade.id][_rd.id].score}">
									<f:convertNumber minFractionDigits="1" maxFractionDigits="2" groupingUsed="false" />
								</h:outputText>
							</p:outputPanel>
						</p:column>
					</c:forEach>
					
					<p:column headerText="合计">
						<c:set var="tradeSum" value="0" />
						<c:forEach items="#{bulletinHome3.instance.defs}" var="_rd">
							<c:set var="tradeSum" value="#{tradeSum + bestTradeEvaluationOfBulletinList.resultMap[_trade.id][_rd.id].score}" />
						</c:forEach>
						<p:outputPanel style="text-align: right;">
							<h:outputText value="#{tradeSum+_trade.tradeReportData.offerScore}">
								<f:convertNumber minFractionDigits="1" maxFractionDigits="2"/>
							</h:outputText>
						</p:outputPanel>
					</p:column>
					
					<p:column headerText="操作" style="text-align: center;">
						<p:button value="评分" outcome="auditTradeApply.xhtml" includeViewParams="true">
							<f:param name="tradeId" value="#{_trade.id}"></f:param>
						</p:button>
					</p:column>
				</p:dataTable>
			</p:panel>
			
			<p:panel header="驳回原因">
				
				<h:outputText value="#{bpmHome.task.processVariables.refuseReason}" />
			
			</p:panel>

			<p:commandButton
				action="/business/buyer/buyerTaskList.xhtml?processKey=bestChooseAudit&amp;faces-redirect=true"
				value="发布评分结果"
				actionListener="#{bulletinHome3.buyerReportBestChooseEvaluation()}"
				disabled="#{not bulletinHome3.canPublishBestChooseResult}"
				ajax="false" />
				
			<p:button outcome="/business/buyer/buyerTaskList.xhtml" value="取消">
				<f:param name="processKey" value="bestChooseAudit"></f:param>
			</p:button>			
		</h:form>
		
   	</ui:define>
</ui:composition>
